package com.example.javaeekeshe.mapper;

import com.example.javaeekeshe.pojo.AdBean;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AdMapper {
    /**
     * 查询所有
     * @return
     */
    @Select("select * from ad")
    public List<AdBean> selectAllAd();


    /**
     * 插入广告
     * @param adBean
     */
    @Insert("INSERT INTO `ad` (`id`, `url`, `img`) VALUES (null, #{url}, #{img})")
    public void addAd(AdBean adBean);

    @Delete("delete from ad where id=#{id} ")
    public void del(Integer id);

    @Update("UPDATE ad SET url = #{url} WHERE id = #{id}")
    public void update(AdBean adBean);
}
